<?php
class HouseModel extends  CommonModel {
    protected $_auto = array(
        array('create_time','time',1,'function'),
        array('update_time','time',2,'function'),
        array('is_ac','getCheckBoxValue',3,'callback'),
        array('is_tv','getCheckBoxValue',3,'callback'),
        array('is_freezer','getCheckBoxValue',3,'callback'),
        array('is_washing','getCheckBoxValue',3,'callback'),
        array('is_calorifier','getCheckBoxValue',3,'callback'),
        array('is_internet','getCheckBoxValue',3,'callback'),
        array('is_microwave','getCheckBoxValue',3,'callback'),
        array('is_dvd','getCheckBoxValue',3,'callback'),
        array('is_kitchen','getCheckBoxValue',3,'callback'),
        array('is_bathroom','getCheckBoxValue',3,'callback'),
        array('is_wc','getCheckBoxValue',3,'callback'),
    );

    public $_validate	=	array(
            array('name','require','房型名称必填'),
            array('name','','房型已经存在',self::EXISTS_VAILIDATE,'unique',self::MODEL_INSERT),
    );

    protected  function getCheckBoxValue($field){
        return $value = $field =='on'?1:0;
    }
}
?>
